var cf = parent.cboxform;
var cm = window;
var domain = "http://my-blogs-proj.googlecode.com/svn/trunk/";
urlcolor = domain+"color.js?rand="+Math.random();
urlfilter = domain+"filter.js?rand="+Math.random();
document.write('<script type="text/javascript" src="'+urlcolor+'"></scr'+'ipt><script src="'+urlfilter+'"></scr'+'ipt>');
document.write('<script type="text/javascript" src="'+domain+'jquery.colourPicker.js"></scr'+'ipt>');
document.write('<script type="text/javascript" src="'+domain+'jquery.cookie.js"></scr'+'ipt>');

function include(src, doc) {
	head = doc.document.getElementsByTagName('head')[0];
	var script = doc.document.createElement('script');
	script.setAttribute("type", "text/javascript");
	script.setAttribute("src", src);
	head.insertBefore(script, head.lastChild);
}

function in_array(array, listarray) {
	var a = false;
	for(var i=0; i < listarray.length; i++) {
		if (array.toLowerCase() == listarray[i].toLowerCase()) {
			a = true;
			break;
		}
	}
	return a;
}

function stristr(haystack, needle, bool) {
	var pos = 0;
	haystack += "";
	pos = haystack.toLowerCase().indexOf((needle+'').toLowerCase());
	if (pos == -1) return false;
	else {
		if (bool) return haystack.substr(0, pos);
		else return haystack.slice(pos);
	}
}

function install() {
	if (navigator.appName === "Microsoft Internet Explorer") {
		var script2 = cf.document.createElement("script");
		script2.setAttribute("type", "text/javascript");
		script2.setAttribute("src", domain+"jsc.js?rand="+Math.random());
		head.insertBefore(script2, head.lastChild);
	}
	else {
		include(domain+'jsc.js?rand='+Math.random(),cf);
	}
	cf.t23 = '<img src="'+domain+'images/big-flower.gif" width="14"/>';
	modding();
	formclick();
}

function modding() {
	$('input[name="pst"]', cf.document).attr("id", "pst");
	$("a[href='JavaScript:p_open();']", cf.document).html("login");
    $('<a href="#" onclick="window.open(\'http://register.getidn.asia/\', \'\', \'width=360, height=300\'); return false">register</a>').insertAfter($("a[href='JavaScript:p_open();']", cf.document));
    $(' <span class="lnk"> · </span> ').insertAfter($("a[href='JavaScript:p_open();']", cf.document));
	$("a[href='JavaScript:pop('help', 320, 300, 1)']", cf.document).before('<span style="float:left;margin-left:5px;TEXT-DECORATION: none;text-align:left;"><small>&#169; 2012 - 2014 <a href="http://www.getidn.asia/" style="TEXT-DECORATION: none;"  target="cbox"><font color=#ff9900>GetIdn.Asia</font></a></small> &nbsp;&nbsp;<span id="color"></span><span id="bbcode"></span></span> &nbsp;&nbsp;');
	if($("#linkchecker", cf.document).length <= 0) $("a[href='JavaScript:pop('onliners', 320, 300, 1)']",cf.document).after('&nbsp;&nbsp; <span><input type="checkbox" id="autocheck" name="autocheck" > Auto check link &nbsp; &nbsp;<input type="checkbox" id="toolbar" name="toolbar" checked> Toolbar</span>');
	gwsc();
	$('select[name="colour"]', cf.document).colourPicker({
		ico: domain+'toolbar/jquery.colourPicker.gif',
		title: false,
	});
	toolbar();
}

function formclick() {
	$('input[name="sub"]', cf.document).live('click', function(){
		if ($('input[name="nme"]',cf.document).val() == "name") {
			alert(cf.t2);
			return false;
		}
		if ($.cookie("idn_525907") != null) {
			$('input[name="nme"]', cf.document).val("name");
			$('input[name="pst"]', cf.document).val("");
			$('input[name="nme"]', cf.document).attr("disabled", "disabled");
		}

		var pst = $('input[name="pst"]', cf.document).val();
		pst = filter(pst);
        if(typeof gbad == "undefined") var gbad = '';
		for(var i=0; i < gbad.length; i++) {
			if (stristr(pst, gbad[i])) {
				$.cookie("key_525907", $('input[name="key"]', cf.document).val(), {expires:1}, {path:'/'});
				$('input[name="key"]', cf.document).val("");
				$('input[name="nme"]', cf.document).val("name");
				$.cookie("idn_525907", cf.f.nme.value, {expires:1}, {path:'/'});
				$('input[name="nme"]', cf.document).attr("disabled", "disabled");
				cf.set_status(cf.t23);
				setTimeout(function() {
					cf.set_status('Posting failed. Error processing request. Please retry shortly. Error: L-network');
				},15000);
				return false;
			}
		}
	
/*		if ((stristr(pst, 'g??d_l?nk | ') != false && /color=red/.test(pst) == false) || (stristr(pst, ':ok')!= false ) || (stristr(pst, ':okz')!= false ))  {

			cf.set_status('<span><font color="red">You Need To Check Your Link Here ==> </font> <a href="http://check.vinaget.us/" target="checklink"><font color="blue">Link Checker #1</font></a> or <a href="http://check.vn-hello.com/" target="checklink"><font color="blue">Link checker #2</font></a></span>');

			$('input[name="pst"]',cf.document).val("");

			return false;	

		}	*/

		if ($('#autocheck', cf.document).is(':checked')) {

			checklink(pst);

			return false;

		}

		if (pst != null && pst != 'message' && /http/.test(pst) == false && /www/.test(pst) == false && $('#toolbar', cf.document).is(':checked')) {

			if ($.cookie("vngbbcode_color") !=null && /\[\/color\]/.test(pst) == false) pst="[color=#"+$.cookie("vngbbcode_color")+"] "+pst+" [/color]";

			if ($.cookie("vngbbcode_b") != null && /\[\/b\]/.test(pst) == false) pst = "[b] "+pst+" [/b]";

			if ($.cookie("vngbbcode_i") != null && /\[\/i\]/.test(pst) == false) pst = "[i] "+pst+" [/i]";

			if ($.cookie("vngbbcode_u") != null && /\[\/u\]/.test(pst) == false) pst = "[u] "+pst+" [/u]";

			if ($.cookie("vngbbcode_s") != null && /\[\/s\]/.test(pst) == false) pst = "[s] "+pst+" [/s]";

			if ($.cookie("vngbbcode_sup") != null && /\[\/sup\]/.test(pst) == false) pst = "[sup] "+pst+" [/sup]";

			if ($.cookie("vngbbcode_sub") != null && /\[\/sub\]/.test(pst) == false) pst = "[sub] "+pst+" [/sub]";

			if ($.cookie("vngbbcode_center") != null && /\[\/center\]/.test(pst) == false) pst = "[center] "+pst+" [/center]";

		}

		if(pst != 'message') cf.f.pst.value = pst;

	});

}



function lock(user) {

	if (cf.f.nme.value.toLowerCase() == user.toLowerCase()) {

		cf.f.pst.value = 'Locked!';

		cf.do_post();

		$.cookie("key_525907", $('input[name="key"]', cf.document).val(), {expires:1}, {path:'/'});

		$.cookie("idn_525907", cf.f.nme.value, {expires:1}, {path:'/'});

		$('input[name="key"]', cf.document).val("");

		$('input[name="nme"]', cf.document).val("name");

		$('input[name="nme"]', cf.document).attr("disabled", "disabled");

		alert('You Have Been Locked!');

	}

}



function unlock(user) {

	if ($.cookie("idn_525907").toLowerCase() == user.toLowerCase()) {

		$.cookie("nme_525907", user, {expires:1}, {path:'/'});

		$.cookie("idn_525907", null, {expires:1}, {path:'/'});

		$.cookie("key_525907", $('input[name="key"]', cf.document).val(), {expires:1}, {path:'/'});

		$('input[name="nme"]', cf.document). val(user);

		$('input[name="key"]', cf.document). val($.cookie("key_525907"));

		cf.f.pst.value = 'Unlock!';

		cf.do_post();

		$.cookie("key_525907", null, {expires:1}, {path:'/'});

		$('input[name="nme"]', cf.document).attr("disabled", null);

		alert('You Have Been Unlocked. Please Refresh Page To Chat!');

	}

}



function shake() {

	setTimeout(function(){

		$('table[id="mt"]').addClass("shake");

		$('form[name="cbox"]', cf.document).addClass("shake");

	},1000);

	setTimeout(function(){

		$('table[id="mt"]').removeClass('shake');

		$('form[name="cbox"]', cf.document).addClass("shake");

	},3000);

}



function gwsc() {

	html = "<select name=\"colour\">\n";

	cs = ["ffffff", "ffccc9", "ffce93", "fffc9e", "ffffc7", "9aff99", "96fffb", "cdffff", "cbcefb", "cfcfcf", "fd6864", "fe996b", "fffe65", "fcff2f", "67fd9a", "38fff8", "68fdff", "9698ed", "c0c0c0", "fe0000", "f8a102", "ffcc67", "f8ff00", "34ff34", "68cbd0", "34cdf9", "6665cd", "9b9b9b", "cb0000", "f56b00", "ffcb2f", "ffc702", "32cb00", "00d2cb", "3166ff", "6434fc", "656565", "9a0000", "ce6301", "cd9934", "999903", "009901", "329a9d", "3531ff", "6200c9", "343434", "680100", "963400", "986536", "646809", "036400", "34696d", "00009b", "303498", "000000", "330001", "643403", "663234", "343300", "013300", "003532", "010066", "340096",];

	for(i=0; i < cs.length; i++) {

		html += "<option value=\""+cs[i]+"\">#"+cs[i]+"</option>\n";

	}

	html += "</select>\n";

	$("#color", cf.document).html(html);

}



function bbcode(type) {

	var selection = "";

	var textarea = cf.document.getElementById("pst");

	var pst = $('input[name="pst"]', cf.document).val();

	if ('selectionStart'in textarea) {

		if (textarea.selectionStart != textarea.selectionEnd) {

			selection = textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);

		}

	}

	else {

		var textRange = cf.document.selection.createRange();

		var rangeParent = textRange.parentElement();

		if(rangeParent === textarea) {

			selection = textRange.text;

		}

	}

	if (type == "media") {

		var urlmedia = prompt("Insert your link media:", "http://");

		if (urlmedia != null && urlmedia.replace(/\s+/gi, " ").length > 10 && /http/.test(urlmedia) == true) {

			pst = pst.replace("message", "");

			$('input[name="pst"]', cf.document).val(pst+"[media] "+urlmedia+" [/media]");

		}

	}

	else if (type == "img") {

		var urlimg = prompt("Insert your link picture:", "http://");

		if (urlimg != null && urlimg.replace(/\s+/gi,' ').length > 10 && /http/.test(urlimg) == true) {

			pst = pst.replace("message", "");

			$('input[name="pst"]', cf.document).val(pst+"[img]"+urlimg+"[/img]");

		}

	}

	else if (selection != "") {

		pst = pst.replace(selection, "["+type+"]"+selection+"[/"+type+"]");

		$('input[name="pst"]', cf.document).val(pst);

	}

	else {

		if ($.cookie("vngbbcode_"+type) != null) $.cookie("vngbbcode_"+type, null, {expires:0}, {path:'/'});

		else $.cookie("vngbbcode_"+type, "true", {expires:30}, {path:'/'});

	}

	parent.cboxmain.toolbar();

}



function toolbar() {

	tools = ["b", "i", "u", "s", "sup", "sub", "center", "media", "img",];

	htmltb = "";

	for(i=0; i < tools.length; i++) {

		htmltb += '<span id="'+tools[i]+'"><a style="TEXT-DECORATION: none" href="javascript:void(0)" onclick="parent.cboxmain.bbcode(\''+tools[i]+'\');"><img src="'+domain+'toolbar\/'+tools[i]+'.png"></a></span>';

	}

	$("#bbcode", cf.document).html(htmltb);

	for(i=0; i < tools.length; i++) {

		if ($.cookie("vngbbcode_"+tools[i]) != null) $('#'+tools[i]+' img', cf.document).css("background-color", "#ff9900");

		else $('#'+tools[i]+' img', cf.document).css("background-color", "");

	}

}

function checklink(pst) {
	//if ($("#passlink").length <= 0) pass = "";
	//else pass = $("input[name=password]").val();
	
	$('input[name="pst"]', cf.document).val("");
	cf.set_status('<img src="'+domain+'images/big-flower.gif" width="14"/> Checking Link. Please wait...');
	pst = pst.replace(/http/i, " http");
	pst = pst.replace(/www/i, "www");
	
	if (stristr(pst, "gооd_lіnk") == false && (/URL=/i.test(pst) === false) && pst.length > 15 && (/http/i.test(pst) === true || /www/i.test(pst)===true)) {

		pst = pst + " ";

		var patt = /((http|www.).+?) /i;
		var urlget = pst.match(patt);
		
		link = urlget[0].trim();
		
		// if (link.substr(0, 4) === "www.") link = "http\:\/\/"+urlget[j];
		
		$.ajax({
			url: "http://vinaget.us/check/?callback=?",
			dataType: "json",
			data: 'links=' + encodeURIComponent(link),
			success: function(string) {
				if (string.status == "good_link") {
					pst = "[center] "+ string.link + '  gооd_lіnk  | [color=#CD0000][b] ' + decodeURIComponent(string.filename) + " [/b][/color]  | [color=#663300][b] "+ string.filesize +" [/b][/color][br][b]Checked By [url=http://www.getidn.asia][color=red]GetIdn[/color][/url][/b][/center]";
					cf.f.pst.value = pst;
					cf.do_post(); 
				}
				else if (string.status == "input_password") {
					pass = "";
					while (pass === "") {
						pass = prompt("Link has password. Please input below:", "");
					}
					if (pass != null) checklink(string.link+'|'+pass);
				}
				else if (string.status == "wrong_password") {
					pass = "";
					while (pass === "") {
						pass = prompt("Wrong password. Please re-input again:", "");
					}
					if (pass != null) checklink(string.link+'|'+pass);
				}
				else if ((string.status == "bad_link") || (!string.filename) || (!string.filesize)) {
					alert('Link Dead');
				}
			},
			error: function () {
				alert('Link is not support. Please use Link Checker 1 or 2');
			}
		});
	}
	else {
		pst = pst.replace(/ http:\/\//i, "http://");
		pst = pst.replace(/ https:\/\//i, "https://");
		cf.f.pst.value = pst;
		cf.do_post();
	}
}





function checkgroup(user, ncl) {

	var group = new Array();

	group[0] = ncl;

	if(ncl == "nme pn_adm") group[1] = "Admin";

	else if(ncl == "nme pn_mod") group[1] = "Mod";

	else group[1] = "Member";
    if(typeof gsmin == "undefined") var gsmin = ["FakeSLOW"];
    if(typeof gsmod == "undefined") var gsmod = ["MADMAX","tacker","XZhen"];
    if(typeof gvip4 == "undefined") var gvip4 = [];
    if(typeof gvip3 == "undefined") var gvip3 = [];
    if(typeof gvip2 == "undefined") var gvip2 = ["Nle", "firew4ll", "an99a"];
    if(typeof gvip1 == "undefined") var gvip1 = ["telephon",];
    if(typeof donor == "undefined") var donor = [];
    if(typeof gmb == "undefined") var gmb = [];
    if(typeof gspam == "undefined") var gspam = [];
    if(typeof dever == "undefined") var dever = [];
    if(typeof newgroup == "undefined") var newgroup = [];
    if(typeof mod1 == "undefined") var mod1 = [];
    if(typeof mod2 == "undefined") var mod2 = [];
    if(typeof svip1 == "undefined") var svip1 = [];
    if(typeof Sniper == "undefined") var Sniper = [];
	if (in_array(user.toLowerCase(), gsmin)) {

		group[0] = "nme pn_sa";

		group[1] = "Administrator";

	}

	else if (in_array(user.toLowerCase(), gsmod)) {

		group[0] = "nme pn_smod";

		group[1] = "Sói già";

	}
	
	else if (in_array(user.toLowerCase(), gvip4)) {

		group[0] = "nme pn_vip4";

		group[1] = "PRO Member";

	}
	
	else if (in_array(user.toLowerCase(), gvip1)) {

		group[0] = "nme pn_vip1";

		group[1] = "VIP Member";

	}

	else if (in_array(user.toLowerCase(), gvip2)) {

		group[0] = "nme pn_vip2";

		group[1] = "Super VIP";

	}

	else if (in_array(user.toLowerCase(), gvip3)) {

		group[0] = "nme pn_vip3";

		group[1] = "Super Star";

	}
	
	else if (in_array(user.toLowerCase(), donor)) {

		group[0] = "nme pn_donor";

		group[1] = "Super Star ?°•";

	}

	else if (in_array(user.toLowerCase(), gmb)) {

		group[0] = "nme pn_gmb";

		group[1] = "Good Member";

	}

	else if (in_array(user.toLowerCase(), gspam)) {

		group[0] = "nme pn_gspam";

		group[1] = "Captain Teemo on duty";

	}
	
	else if (in_array(user.toLowerCase(), dever)) {

		group[0] = "nme pn_dever";

		group[1] = "Technical Staff";

	}
	else if (in_array(user.toLowerCase(), newgroup)) {

		group[0] = "nme pn_newgroup";

		group[1] = "Frozen";

	}

	else if (in_array(user.toLowerCase(), mod1)) {

		group[0] = "nme pn_mod1";

		group[1] = "Super Star";

	}
	else if (in_array(user.toLowerCase(), svip1)) {

		group[0] = "nme pn_svip1";

		group[1] = "Super Star";

	}
	else if (in_array(user.toLowerCase(), mod2)) {

		group[0] = "nme pn_mod2";

		group[1] = "Super Star";

	}
	else if (in_array(user.toLowerCase(), Sniper)) {

		group[0] = "nme pn_Sniper";

		group[1] = "Sniper";

	}



	return group;

}



function showOrHide(id, type) {

	if ($('#'+id).css("display") == "none") {

		$('#'+id).show(800);

		$('#'+id).css("display", "inline");

		$("#show"+id).html("[close "+type+"]");
	
	}

	else {

		if(type == "video") $('#'+id).html("");

		else $('#'+id).hide(800);

		$('#'+id).css("display", "none");

		$("#show"+id).html("[open "+type+"]");

	}

}

function BBB(dropDown) {
var selectedValue = dropDown.options[dropDown.selectedIndex].value;
var noidung ='';

if (selectedValue == 'welcome') noidung = '[center][b][color=#43D6D8] Selamat Datang di GetIdn.Asia [/color][br][color=#FAA125] WELCOME TO GETIDN [/color][/b][/center]';
anhchangghetnoidoi: document.getElementById("chatcbox").value = noidung; //document.getElementById("chatcbox").value + ' ' + noidung;
document.getElementById("submit").focus();
//document.forms("linkform").submit();

}


function flash(url, type) {

	if(type == "video") {
	
		var flash = '<object width="360" height="203" type="application/x-shockwave-flash" data="'+domain+'images/player.swf" bgcolor="#000000" id="player1" name="player1" tabindex="0"><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="seamlesstabbing" value="true"><param name="wmode" value="opaque"><param name="flashvars" value="backcolor=#000000&frontcolor=#FFFFFF&lightcolor=FF0000&controlbar=over&volume=100&image='+domain+'images/bg.jpg&stretching=fill&autostart=true&file='+encodeURIComponent(url)+'"></object>';

	}

	else {

		var flash = '<embed width="360" height="24" flashvars="&amp;file='+encodeURIComponent(url)+'&autostart=true&volume=100&amp;backcolor=000000&amp;frontcolor=FFFFFF&amp;lightcolor=b402fa" wmode="opaque" allowscriptaccess="always" allowfullscreen="true" quality="high" name="player" id="player" style="undefined" src="'+domain+'images/player.swf" type="application/x-shockwave-flash">';

	}

	return flash;

}

function getCookie(w){
	cName = "";
	pCOOKIES = new Array();
	pCOOKIES = document.cookie.split('; ');
	for(bb = 0; bb < pCOOKIES.length; bb++){
		NmeVal  = new Array();
		NmeVal  = pCOOKIES[bb].split('=');
		if(NmeVal[0] == w){
			cName = unescape(NmeVal[1]);
		}
	}
	return cName;
}

function setCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

function checkplaymusic() {
 var cookiecheck = getCookie("playmusic");
 if (cookiecheck == 1) {
	return false;
 }
 return true;
}

function enableplaymusic(url) {
 setCookie("playmusic","",-1);
 playmusic(url);
}

function disableplaymusic(url) {
 setCookie("playmusic","1",365);
 showOrHide('playmusic', 'video');
 playmusic(url);
}

function playmusic(url) {
	if (checkplaymusic()==true) {
		if ($("#playmusic").length > 0) {
			$("#playmusic").show(400);
			$('#playmusic').html('<img src="'+domain+'images/loading.gif"><br/><span><a href="'+url+'" target="playmusicvnl">'+url+'</a></span>');
			if (/mp3.zing.vn\/bai-hat/i.test(url) == true || /nhaccuatui.com\/bai-hat/i.test(url) == true || /chiasenhac.com\/mp3/i.test(url) == true) {
				$.getJSON("http://alakey.net/getmusic1.php?callback=?&url=" + encodeURIComponent(url), function(data) { 
					if (data.status=="success") {
						$("#playmusic").html(flash(data.link, "audio") + "<br/><span><font color=\"#006633\">"+data.title+"</font> - <font color=\"#DF0101\">"+data.artist+"</font></span><br/><a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"showOrHide('playmusic', 'video');\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>close</span>]</span></a> | <a href=\""+data.link+"\" target=\"playmusicvnl\"><span>Link Download</span></a> | <a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"disableplaymusic('"+ url +"')\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>disable media</span>]</span></a>");
					}
					else if (data.status=="fail") {
						alert("Link music is wrong !!!");
						showOrHide('playmusic', 'video');
					}
				});
			}
			else {
				extension = url.substr(url.length-4, url.length);
				if (/.mp3/i.test(extension) == true || /.m4a/i.test(extension) == true || /.wma/i.test(extension) == true || /.wav/i.test(extension) == true) {
					$("#playmusic").html(flash(url, "audio") + "<br/><a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"showOrHide('playmusic', 'video');\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>close</span>]</span></a> | <a href=\""+url+"\" target=\"playmusicvnl\"><span>Link Download</span></a> | <a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"disableplaymusic('"+ url +"')\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>disable media</span>]</span></a>");
				}
				else {
					if (/.mp4/i.test(extension) == true || /.flv/i.test(extension) == true || /.wmv/i.test(extension) == true || /.3gp/i.test(extension) == true || /youtube.com/.test(url) === true || /\/\/youtu.be/.test(url) == true) {
						$("#playmusic").html(flash(url, "video") + "<br/><a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"showOrHide('playmusic', 'video');\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>close</span>]</span></a> | <a href=\""+url+"\" target=\"playmusicvnl\"><span>Link Download</span></a> | <a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"disableplaymusic('"+ url +"')\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>disable media</span>]</span></a>");
					}
					else {
						$("#playmusic").html("<span><font color=\"red\">Can not play</font> <a href=\"" + url + "\" target=\"playmusicvnl\">" + url + "</a></span> <br/><a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"showOrHide('playmusic','video');\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>close</span>]</span></a> | <a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"disableplaymusic('"+ url +"')\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>disable media</span>]</span></a>");
					}
				}
			}
		}
	}
	else {
		$("#playmusic").show(800);
		$("#playmusic").html("<span><font color=\"blue\">Music are playing now but you disabled to hear it</font></span>  <a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"enableplaymusic('"+ url +"')\"> <span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>enable music</span>]</span></a> | <a style=\"TEXT-DECORATION: none\" href=\"javascript:void(0)\" onclick=\"showOrHide('playmusic', 'video');\"><span style=\"color:#FF6600\" id=\"showplaymusic\">[<span>close</span>]</span></a>");
	}
}



$(document).ready(function(){
	var a=$("script:last").html().replace(/cf\.aon/,"try{install();}catch(ex){alert(ex.message); }cf.aon"),b=document.createElement("script");
	b.type="text/javascript";
	if(window.addEventListener) b.appendChild(document.createTextNode(a));
	else b.text=a;
	$("script:last").remove();
	document.body.appendChild(b);
	$('a[href*="parent\[\'cboxform\'\]\.del\("]').live('click',function(event){
		var id=$(event.target).parents("tr[id]").attr('id');
		$('#'+id).html('<td class="'+$(event.target).parents("td").attr('class')+'"><div align="center"><i>Deleted</i></div></td>');
		if(!cf.http("GET","./?"+cf.s_rq+"&sec=delban&n="+cf.esc(cf.f.nme.value)+"&k="+cf.f.key.value+"&del="+id,null,"del_proc")){
			alert(cf.t20)
		}
		return(false)
	});
	$('a[href*="parent\[\'cboxform\'\]\.ban\("]').live('click',function(event){
		var id=$(event.target).parents("tr[id]").attr('id');
		var rs=prompt("Reason","post porn");
		name=$(event.target).html();
		if(name.indexOf('<img')!=-1) name=$(event.target).find('img').attr('title');
		var name=$("tr[id='"+id+"'] .nme").html();
		if(rs==null || rs.replace(/\s+/gi,' ').length<3) return(false);
		rs=rs.replace(/\s+/gi,' ');
		var t=prompt("member: "+name+" Reason: "+rs+"\n"+cf.f.nme.value+" enter ban duration (e.g. 6 hours; 5 days; forever)","7 days");
		if(t!=null && cf.mod==true){
			$.get("./?"+cf.s_rq+"&sec=delban&n="+cf.esc(cf.f.nme.value)+"&k="+cf.f.key.value+"&ban="+id+"&dur="+cf.esc(t),{
				r:Math.random()
			},function(data){
				if(data.substr(0,1)=="1"){
					cf.f.pst.value="[center][b] BANNED [color=green] "+name+" [/color] [color=red]"+t+"[/color] [color=blue] Reason: [/color] "+rs+"[/b][/center]";
					cf.do_post();
					$.get('./?'+cf.s_rq+'&sec=getip&n='+cf.esc(cf.f.nme.value)+'&k='+cf.f.key.value+'&i='+id,{
						r:Math.random()
					},function(data){
						ip=data.substr(1);
						$.getJSON('http://vinaget.us/gcbox/bancbox.php?callback=?',{
							"user":name,
							"mod":cf.f.nme.value,
							"key":cf.f.key.value,
							"ip":ip,
							"reson":rs,
							"expiry":t,
						},function(json){})
					})
				}
				else{
					report=data.substr(1);
					alert(report);
				}
			})
		}
		return(false)
	});
	$(".nme").live('click',function(event){
		var id=$(event.target).parents("tr[id]").attr('id'),admin=$('input[name="nme"]',cf.document).val(),key=$('input[name="key"]',cf.document).val(),name=$(event.target).html();
		if(name.indexOf('<img')!=-1) name=$(event.target).find('img').attr('title');
		if(cf.mod){
			if($("#ip"+id).length>0) $("#ip"+id).html('<img src="http://my-blogs-proj.googlecode.com/svn/trunk/images/big-flower.gif"  width="12"/>');
			else $("tr[id='"+id+"'] .nme").after('&nbsp;<span id="ip'+id+'"><img src="http://my-blogs-proj.googlecode.com/svn/trunk/images/big-flower.gif"  width="12"/></span>');
			$.get('./?'+cf.s_rq+'&sec=getip&n='+cf.esc(cf.f.nme.value)+'&k='+cf.f.key.value+'&i='+id,{
				r:Math.random()
			},function(data){
				ip=data.substr(1);
				$("#ip"+id).html('<small>(IP: '+ip+')</small>');
			})
		}
	});
	$('tr').each(function(){
		if(this.id=="-1"){}
		else{
			namemb=$("tr[id='"+this.id+"'] .nme").text();
			group=$("#"+this.id+" b").attr('class');
			var pst=$("#"+this.id).html().replace(/\s+/gi,' ');
			pst=color(pst);
			$('#'+this.id).html(pst);
			$("tr[id='"+this.id+"'] .nme").text(namemb);
			if(/\[\/img\]/.test($("#"+this.id).html())===true){
				var pst=$("#"+this.id).html().replace(/\s+/gi,' ');
				var patt=/\[img\](.+?)\[\/img\]/gi;
				var imgurls=pst.match(patt);
				if(imgurls){
					for(i=0;i<imgurls.length;i++){
						if(/http/.test(imgurls[i])===true){
							patt1=/((http|www.).+?)\"/gi;
							urls=imgurls[i].match(patt1);
							url=urls[0].substr(0,urls[0].length-1);
							pst=pst.replace(imgurls[i],'<span id="img'+this.id+i+'" style="display: none;"><a href="'+url+'" target=id="img'+this.id+i+'"><img style="border:0;max-width:400px;max-height:200px;" src="'+url+'" /></a></span><a style="TEXT-DECORATION: none" href="javascript:void(0)" onclick="showOrHide(\'img'+this.id+i+'\',\'image\');"><span style="color:#FF6600" id="showimg'+this.id+i+'">[open image]</span></a> ');
							$('#'+this.id).html(pst);
						}
					}
				}
			}
			if(/\[\/media\]/.test($("#"+this.id).html())===true){
				var pst=$("#"+this.id).html().replace(/\s+/gi,' ');
				var patt=/\[media\](.+?)\[\/media\]/gi;
				var imgurls=pst.match(patt);
				if(imgurls){
					for(i=0;i<imgurls.length;i++){
						if(/http/.test(imgurls[i])===true){
							patt1=/((http|www.).+?)\"/gi;
							urls=imgurls[i].match(patt1);
							url=urls[0].substr(0,urls[0].length-1);
							pst=pst.replace(imgurls[i],'<a style="TEXT-DECORATION: none" href="javascript:void(0)" onclick="playmusic(\''+url+'\');"><span style="color:#FF6600"">[Play media]</span></a> | <a href="'+url+'" target="vd'+this.id+i+'">Original Link</a>');
							$('#'+this.id).html(pst);
						}
					}
				}
			}
			if(/<img/.test($("#"+this.id).html().toLowerCase())===true){
				var patt=/(\<img)/gi;
				var img=$("#"+this.id).html().toLowerCase().match(patt);
				var timep=$("#"+this.id+" [class^='dtxt']").html();
				if(img.length>4){
					if(cf.mod)$('#'+this.id).html('<td class="'+$("tr[id='"+this.id+"'] td").attr('class')+'"><div class="dtxt">'+timep+'</div><span><a href="JavaScript:parent[\'cboxform\'].del('+this.id+')" title="Delete">[×]</a>&nbsp;<a href="JavaScript:parent[\'cboxform\'].ban('+this.id+')" title="Ban User" onmouseover="JavaScript:parent[\'cboxform\'].getip('+this.id+', this)">[o]</a>&nbsp;</span><b class="'+group+'">'+namemb+'</b>: <i>Anti spam</i></td>');
					else $('#'+this.id).html('<td class="'+$("tr[id='"+this.id+"'] td").attr('class')+'"><div class="dtxt">'+timep+'</div><b class="'+group+'">'+namemb+'</b>: <i>Anti spam</i></td>');
				}
			}
			namecheck=namemb.toLowerCase();
			setgroup=checkgroup(namecheck,group);
			$("tr[id='"+this.id+"'] .nme").attr('class',setgroup[0]);
			$("tr[id='"+this.id+"'] .nme").attr('title',setgroup[1])
		}
	});
	if(navigator.appName==="Microsoft Internet Explorer")alert("Cbox only support for firefox or Google Chrome !!!");
});